import React, { Component } from "react";
import { Route, Switch, Redirect } from 'react-router-dom'
import MyNavLink from "../../components/MyNavLink";
import News from './News'
import Message from './Message'


export default class Home extends Component {
  render() {
    return (
      <div>
        <h3>我是Home的内容</h3>
        <hr />
        <MyNavLink to="/home/news" children="News"></MyNavLink>
        <MyNavLink to={`/home/message`} children="Message"></MyNavLink>

        {/* 注册路由 */}
        <Switch>
          <Route path="/home/news" component={News}></Route>
          <Route path="/home/message" component={Message}></Route>
          <Redirect to="/home/news" />
        </Switch>
      </div>
    )

  }
}
